﻿namespace pay.sofort.test
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    [DeploymentItem(@"example\", "example")]
    [DeploymentItem(ConfigFileName)]
    public class TestObjectXml : TestBase
    {
        [TestMethod]
        public void TestXmlToObjectTransactions()
        {
            TPaySofortConfig config = TPaySofortConfig.LoadFromFile(ConfigFileName);
            string xmlIn = GetXmlTestData("transactions.xml");
            var transaction = TPaySofortXml.CreateTransaction(xmlIn, config);
            Assert.IsNotNull(transaction);
        }

        [TestMethod]
        public void TestXmlToObjectNewTransactions()
        {
            TPaySofortConfig config = TPaySofortConfig.LoadFromFile(ConfigFileName);
            string xmlIn = GetXmlTestData("new_transaction.xml");
            var newTransaction = TPaySofortXml.CreatePaySofortNewTransaction(xmlIn, config.Username);
            Assert.IsNotNull(newTransaction);
        }

        [TestMethod]
        public void TestXmlToObjectStatusNotfication()
        {
            TPaySofortConfig config = TPaySofortConfig.LoadFromFile(ConfigFileName);
            string xmlIn = GetXmlTestData("status_notification.xml");
            var statusNotification = TPaySofortXml.CreatePaySofortStatusNotfication(xmlIn, config.Username, "url", "receive");
            Assert.IsNotNull(statusNotification);
        }
    }
}
